

import 'dart:ffi';
// import 'dart:js';

import 'package:flutter/material.dart';
import 'package:flutter_application_1/alert.dart';
import 'package:flutter_application_1/home_page_0.dart';
import 'package:flutter_application_1/home_page_1.dart';
import 'package:flutter_application_1/pravicy_alert.dart';
import 'package:flutter_application_1/version_update_alert.dart';
import 'package:get/state_manager.dart';

class GHHomePage extends StatefulWidget {
  const GHHomePage({super.key});

  @override
  State<GHHomePage> createState() => _GHHomePageState();
}

class _GHHomePageState extends State<GHHomePage> {

  var status = 1.obs;

@override
void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {

   return Scaffold(
    body: Stack(children: [
      Container(decoration: const BoxDecoration(image: DecorationImage(image:  AssetImage('images/home_bg_0.png'), fit: BoxFit.cover,)),),
      SafeArea(child: Column(children: [
        bar(),
        page()
      ],))
    ],)
   );
  }

  Widget page() {
    if (status.value == 0){
      return const HomePage0();
    } else if (status.value == 1) {
      return const HomePage1();
    }
    return Container();
  }

  Widget bar() {
    return Row(
    children: [
      const SizedBox(width: 16,),
      const Expanded(
              flex: 0,
              child: Text('Bantuan Tunai', style: TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold),),
            ),
      const Spacer(),
              // Image(image: AssetImage('images/home_service_green.png'), width: 30, height: 30,),
      IconButton(icon: const Image(image: AssetImage('images/home_service_green.png'), width: 30, height: 30,), onPressed: (){ 
        PravicyAlert.show(context);
      },),
      const SizedBox(width: 16,),
  ]);
  }
}